package db

import (
	"database/sql"
)

type DBClient struct {
	Host     string
	User     string
	Password string
	Port     int
	Database string
}

func (d *DBClient) DoQuery(in interface{}) (interface{}, error) {
	return nil, sql.ErrNoRows
}

type DBOption = func(db *DBClient)

func NewDB(host, user, password string, opts ...DBOption) *DBClient {
	db := &DBClient{
		Host:     host,
		User:     user,
		Password: password,
		Port:     3306,
		Database: "yx",
	}
	for _, opt := range opts {
		opt(db)
	}
	return db
}

func WithPort(port int) DBOption {
	return func(db *DBClient) {
		db.Port = port
	}
}

func WithDatabase(dbName string) DBOption {
	return func(db *DBClient) {
		db.Database = dbName
	}
}
